<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="sockjs-0.3.min.js"></script>

<script type="text/javascript">

	function connect() {
	//     var url1 = websocketDomain+"/ep-websocket/hallws.do";
	    var url2 = "http://localhost:8080/ep-websocket/websocket/socketjs/hallws";
	//    ws = new WebSocket(url1);
	   
	//    if ('WebSocket' in window) {
	//        ws = new WebSocket(url1);
	//    } else if ('MozWebSocket' in window) {
	//        ws = new MozWebSocket(url1);
	//    } else {
	//        ws = new SockJS(url2);
	//    }
		console.log(url2);
	    ws = new SockJS(url2);
	    
	    ws.onopen = function () {
	    };
	    ws.onmessage = function (event) {
	    	//数据派发
	    	var data  = JSON.parse(event.data);
	    	var eventType = data._type;
	    	var d = data;//真正的业务数据
	    	switch(eventType){
	    	case 'roomSpeeked'://房间喊话数据更新
	    		var dataArr = [d];
	    		addSpeekDataFun(dataArr);
	    		break;
	    	}
	    };
	    ws.onclose = function (event) {
	    };
	};
	
	connect();

</script>
</head>
<body>
hello world
</body>
</html>